package com.cskaoyan.controller.mallController;

import com.cskaoyan.model.vo.BaseRespVo;
import com.cskaoyan.model.vo.mall.RegionBeanVo;
import com.cskaoyan.service.mall.MallService;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admin/region")
@RequiresPermissions("admin:region:*")
public class MallRegionController {


    private ObjectMapper objectMapper = new ObjectMapper();

    {
        objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    }

    @Autowired
    MallService mallService;

    @RequestMapping("/list")
    // /admin/region/list
    public BaseRespVo getRegionList(){

        List<RegionBeanVo> regionList = mallService.getRegionList();
        return BaseRespVo.ok(regionList);

    }

}
